package com.jwsoft.manager.core.gateway.controller;

import com.bifang.engine.protect.core.annotation.NoSignCrypto;
import com.jwsoft.manager.common.vo.eduSyncJhApproveError.EduSyncJhApproveErrorQueryVO;
import com.jwsoft.manager.core.integration.EduSyncJhEnrollErrorIntegration;
import com.jwsoft.manager.common.vo.eduSyncJhEnrollError.EduSyncJhEnrollErrorVO;
import com.jwsoft.manager.common.vo.eduSyncJhEnrollError.EduSyncJhEnrollErrorKeyVO;
import com.jwsoft.manager.common.vo.eduSyncJhEnrollError.EduSyncJhEnrollErrorQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

import javax.servlet.http.HttpServletResponse;

/**
 * 金华市报名录取专库同步导入错误表网关
 *
 * @author zhiyuan
 * @since 2024-04-13
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "金华市报名录取专库同步导入错误表", description = "金华市报名录取专库同步导入错误表")
public class EduSyncJhEnrollErrorController {

    @Autowired
    public EduSyncJhEnrollErrorIntegration eduSyncJhEnrollErrorIntegration;

    @Operation(summary = "金华市报名录取专库同步导入错误表分页查询",description = "金华市报名录取专库同步导入错误表分页查询")
    @PostMapping(value = "/syncJhEnrollError0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduSyncJhEnrollErrorVO>> getList(@RequestBody @Validated EduSyncJhEnrollErrorQueryVO vo) {
        return AppResponse.successData(eduSyncJhEnrollErrorIntegration.getList(vo));
    }

    @Operation(summary = "金华市报名录取专库同步导入错误表根据主键查询详情",description = "金华市报名录取专库同步导入错误表根据主键查询详情")
    @PostMapping(value = "/syncJhEnrollError0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSyncJhEnrollErrorVO> getById(@RequestBody @Validated EduSyncJhEnrollErrorKeyVO vo) {
        return AppResponse.successData(eduSyncJhEnrollErrorIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "金华市报名录取专库同步导入错误表新增",description = "金华市报名录取专库同步导入错误表新增")
    @PostMapping(value = "/syncJhEnrollError0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSyncJhEnrollErrorVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduSyncJhEnrollErrorVO vo) {
        return AppResponse.successData(eduSyncJhEnrollErrorIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "金华市报名录取专库同步导入错误表修改",description = "金华市报名录取专库同步导入错误表修改")
    @PostMapping(value = "/syncJhEnrollError0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSyncJhEnrollErrorVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduSyncJhEnrollErrorVO vo) {
        return AppResponse.successData(eduSyncJhEnrollErrorIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "金华市报名录取专库同步导入错误表删除",description = "金华市报名录取专库同步导入错误表删除")
    @PostMapping(value = "/syncJhEnrollError0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduSyncJhEnrollErrorKeyVO vo) {
        eduSyncJhEnrollErrorIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "导出错误数据",description = "导出错误数据")
    @PostMapping(value = "/syncJhEnrollError0007", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public void exportInfo(@RequestBody @Validated EduSyncJhEnrollErrorQueryVO vo, HttpServletResponse response) {
        eduSyncJhEnrollErrorIntegration.exportInfo(vo,response);
    }

}
